home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / PNL Libraries / Libraries / ODB Engine / ODBEngine.p < prev    next >
Text File  |  1996-10-20  |  4KB  |  131 lines

  1. unit ODBEngine;
  2.  
  3. interface
  4.  
  5. { © copyright 1996 UserLand Software, Inc. All Rights Reserved. }
  6.  
  7.     uses
  8.         Types, Quickdraw, Files;
  9.         
  10.     type
  11.         odbRef = Ptr;
  12.         
  13.     type
  14.         odbBool = UInt16;
  15.     
  16.     type
  17.         odbString = Str255;
  18.         odbDirection = (
  19.             nodirection, dir_up, dir_down, dir_left, dir_right, 
  20.             dir_flatup, dir_flatdown, dir_tyd_7, dir_sorted,
  21.             dir_pageup, dir_pagedown, dir_pageleft, dir_pageright );
  22.     
  23.     const
  24.         ctdirections = 12; { for arrays indexed on directions }
  25.  
  26.     type
  27.         odbValueType = OSType;
  28.     
  29.     const
  30.         unknownvaluetype = '????';
  31.         charvaluetype = 'char';
  32.         shortvaluetype = 'shor';
  33.         longvaluetype = 'long';
  34.         binaryvaluetype = 'data';
  35.         booleanvaluetype = 'bool';
  36.         tokenvaluetype = 'tokn';
  37.         datevaluetype = 'date';
  38.         addressvaluetype = 'addr';
  39.         codevaluetype = 'code';
  40.         extendedvaluetype = 'exte';
  41.         stringvaluetype = 'TEXT';
  42.         externalvaluetype = 'xtrn';
  43.         directionvaluetype = 'dir ';
  44.         string4valuetype = 'type';
  45.         pointvaluetype = 'QDpt';
  46.         rectvaluetype = 'qdrt';
  47.         patternvaluetype = 'tptn';
  48.         rgbvaluetype = 'cRGB';
  49.         fixedvaluetype = 'fixd';
  50.         singlevaluetype = 'sing';
  51.         doublevaluetype = 'doub';
  52.         objspecvaluetype = 'obj ';
  53.         filespecvaluetype = 'fss ';
  54.         aliasvaluetype = 'alis';
  55.         enumeratorvaluetype = 'enum';
  56.         listvaluetype = 'list';
  57.         recordvaluetype = 'reco';
  58.         outlinevaluetype = 'optx';
  59.         wptextvaluetype = 'wptx';
  60.         tablevaluetype = 'tabl';
  61.         scriptvaluetype = 'scpt';
  62.         menubarvaluetype = 'mbar';
  63.         picturevaluetype = 'pict';
  64.  
  65.     type
  66.         odbValueData = record
  67.             case integer of
  68.                 1:    ( flvalue: odbBool );
  69.                 2:    ( chvalue: SignedByte );
  70.                 3:    ( intvalue: SInt16 );
  71.                 4:    ( longvalue: SInt32 );
  72.                 5:    ( datevalue: SInt32 );
  73.                 6:    ( dirvalue: odbDirection ); { possibly UInt16/UInt32? }
  74.                 7:    ( ostypevalue: OSType );
  75.                 8:    ( stringvalue: Handle );
  76.                 9:    ( addressvalue: Handle );
  77.                 10:    ( binaryvalue: Handle );
  78.                 11:    ( externalvalue: Handle );
  79.                 12: ( pointvalue: Point );
  80.                 13: ( rectvalue: ^^Handle );
  81.                 14: ( patternvalue: ^^Pattern );
  82.                 15: ( rgbvalue: ^^RGBColor );
  83.                 16: ( fixedvalue: Fixed );
  84. {                17: ( singlevalue: float ); What is the pascal equivalent of Float? }
  85.                 18: ( doublevalue: ^^double );
  86.                 19: ( objspecvalue: Handle );
  87.                 20: ( filespecvalue: FSSpecHandle );
  88.                 21: ( aliasvalue: Handle ); { AliasHandle }
  89.                 22: ( enumvalue: OSType );
  90.                 23: ( listvalue: Handle );
  91.                 24: ( recordvalue: Handle );
  92.         end;
  93.     
  94.     type
  95.         odbValueRecord = record
  96.             valuetype: odbValueType;
  97.             data: odbValueData;
  98.         end;
  99.         
  100.     function odbNewFile( filern: SInt16 ): odbBool;
  101.  
  102.     function odbOpenFile( filern: SInt16; var odb: odbRef ): odbBool;
  103.  
  104.     function odbSaveFile( odb: odbRef ): odbBool;
  105.  
  106.     function odbCloseFile( odb: odbRef ): odbBool;
  107.  
  108.     function odbDefined( odb: odbRef; const bspath: odbString ): odbBool;
  109.  
  110.     function odbDelete( odb: odbRef; const bspath: odbString ): odbBool;
  111.  
  112.     function odbGetType( odb: odbRef; const bspath: odbString; var typ: OSType ): odbBool;
  113.  
  114.     function odbGetValue( odb: odbRef; const bspath: odbString; var value: odbValueRecord ): odbBool;
  115.  
  116.     function odbSetValue( odb: odbRef; const bspath: odbString; var value: odbValueRecord ): odbBool;
  117.  
  118.     function odbNewTable( odb: odbRef; const bspath: odbString ): odbBool;
  119.  
  120.     function odbCountItems( odb: odbRef; const bspath: odbString; var count: SInt32 ): odbBool;
  121.  
  122.     function odbGetNthItem( odb: odbRef; const bspath: odbString; n: SInt32; var bsname: odbString ): odbBool;
  123.  
  124.     function odbGetModDate( odb: odbRef; const bspath: odbString; var date: SInt32 ): odbBool;
  125.  
  126.     procedure odbDisposeValue( odb: odbRef; var value: odbValueRecord );
  127.  
  128.     procedure odbGetError( var bs: odbString );
  129.  
  130. end.
  131.